using System.Windows;

namespace Client.Common
{
    public static class UiElementExtensions
    {
        public static Window GetWindow(this FrameworkElement element)
        {
            if (element == null) return null;
            var window = element as Window;
            if (window != null) return window;
            return element.Parent == null ? null : GetWindow(element.Parent as FrameworkElement);
        }
    }
}